/** * @license * Copyright 2018 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { QueryList } from "@angular/core"; import { Oas30Server } from "apicurio-data-models"; import { EntityEditor, EntityEditorEvent, IEntityEditorHandler } from "./entity-editor.component"; import { NgModel } from "@angular/forms"; export interface ServerVariableData { default: string; description: string; enum: string[]; } export interface ServerData { url: string; description: string; variables: any; } export interface ServerEditorEvent extends EntityEditorEvent { data: ServerData; } export interface IServerEditorHandler extends IEntityEditorHandler { onSave(event: ServerEditorEvent): void; onCancel(event: ServerEditorEvent): void; } export declare class ServerEditorComponent extends EntityEditor { urlInput: QueryList; model: ServerData; url: string; _varSelected: string; /** * Initializes the editor's data model from a provided entity (initialize the editor data model from an entity). * @param entity */ initializeModelFromEntity(entity: Oas30Server): void; /** * Initializes the editor's data model to an empty state. */ initializeModel(): void; /** * Returns true if the data model is valid. */ isValid(): boolean; /** * Creates an entity event specific to this entity editor. */ entityEvent(): ServerEditorEvent; /** * Called when the URL changes. The URL will be parsed to find any variable substitutions * present in the URL spec. The map of variables is then updated to reflect whatever is found. */ updateVariables(): void; /** * Returns true if there are any variables to be configured. * @return */ hasVariables(): boolean; /** * Returns the names of the variables. * @return */ variableNames(): string[]; /** * @param event */ onServerUrlKeypress(event: KeyboardEvent): void; /** * Returns true if there are URL changes. */ canApply(): boolean; /** * Called when the user clicks the "apply" button. */ apply(): void; /** * Called when the user clicks the "reset" button. */ reset(): void; }